/**
 * 
 */
package org.tio.sitexxx.im.server;

import org.tio.core.ChannelContext;
import org.tio.core.PacketConverter;
import org.tio.core.intf.Packet;
import org.tio.sitexxx.im.common.ImPacket;

/**
 * @author tanyaowu
 *
 */
public class ImToWsPacketConverter implements PacketConverter {

	public static final ImToWsPacketConverter me = new ImToWsPacketConverter();

	/**
	 * 
	 */
	private ImToWsPacketConverter() {
	}

	@Override
	public Packet convert(Packet packet, ChannelContext channelContext) {
		if (packet instanceof ImPacket) {
			ImPacket imPacket = (ImPacket) packet;

			return imPacket.toWs();
		}
		return packet;
	}
}
